#ifndef ORDERMANAGEMENTPANEL_H
#define ORDERMANAGEMENTPANEL_H

#include <QWidget>

class QTableWidget;
class QPushButton;
class QLabel;
class QComboBox; // For filtering
class QLineEdit; // For filter value input
class QDateEdit; // For date range filtering

// Forward declaration for C struct
struct OrderNode;

class OrderManagementPanel : public QWidget
{
    Q_OBJECT
public:
    explicit OrderManagementPanel(QWidget *parent = nullptr);
    ~OrderManagementPanel();

private slots:
    void loadOrders();
    void viewOrderDetails(); // Or maybe edit status?
    void deleteOrder();
    void applyFilters(); // Slot to apply selected filters

private:
    void setupUi();
    void populateTable();
    void clearTable();
    void freeOrderList(); // Helper to free C linked list

    QTableWidget* orderTable;
    QPushButton* btnViewDetails; // Or btnChangeStatus
    QPushButton* btnDelete;
    QPushButton* btnRefresh;
    QLabel* lblOrderCount;

    // Filtering controls (Example)
    QComboBox* comboFilterType; // e.g., By User, By Product, By Status
    QLineEdit* editFilterValue;
    QDateEdit* dateStart;
    QDateEdit* dateEnd;
    QPushButton* btnApplyFilter;


    OrderNode* orderListHead = nullptr; // Head of the C linked list for orders
};

#endif // ORDERMANAGEMENTPANEL_H